package cn.edu.sbs.talent.common.entity;

import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.Version;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;

/**
 * BaseEntity
 *
 * @author ctidy
 * @since 2021/1/7
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class BaseEntity {

    /**
     * ID (主键), 雪花算法自动生成, 固定 40 bits
     */
    @TableId
    private Long id;

    /**
     * 创建时间
     */
    private LocalDateTime gmtCreate;

    /**
     * 创建账户ID
     */
    private Long createAccount;

    /**
     * 更新时间, 乐观锁
     */
    @Version
    private LocalDateTime gmtUpdate;

    /**
     * 更新账户ID
     */
    private Long updateAccount;

    /**
     * 逻辑删除标志位 (false 或 0 存在, true 或 1 删除)
     */
    @TableLogic(value = "0", delval = "1")
    private Boolean deleted = false;
}
